def hex_to_decimal(hex):
    hex_chars = '0123456789ABCDEF'
    demical = 0
    i = 0
    length = len(hex)
    for i in range(length):
        demical += hex_chars.index(hex[i]) * 16**(length-i-1)
    return demical


if __name__ == '__main__':
    print(hex_to_decimal("15"))